export default class CountDown {
    constructor(time,callback,finish) {
        this.callback = callback;
        this.count = time;
        this.finish = finish;
    }

    start() {
        console.log('start');
        this.callback(this.count);
        setTimeout(()=> {
            this.count--;
            if (this.count >= 0) {
                this.callback(this.count);
                this.start();
            }else {
                this.finish();
            }
        }, 1000);
    }
}
